package com.fanxuankai.boot.upload;

import com.alibaba.fastjson.JSON;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * @author fanxuankai
 */
public class JsonReader<T> implements Reader<T> {
    @Override
    public List<T> readItems(MultipartFile multipartFile, Class<T> itemType) throws IOException {
        return JSON.parseArray(new String(multipartFile.getBytes()), itemType);
    }
}
